package com.car.dal.dao.goods;

import java.util.List;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgGoods;
import com.car.util.Page;

public class TgGoodsDaoImpl extends IbatisCommonDao<TgGoods, Long> implements TgGoodsDao {

    public GridObj GetList(TgGoods goods, PageObj pageObj) {
        OrderObj order = new OrderObj();
        order.setDir("desc");
        order.setSort("id");
        // TODO Auto-generated method stub
        return super.findByPage(goods, pageObj, order);
    }

    public Integer getGoodsCountByType(TgGoods goods) {
        return this.queryForInteger("getGoodsCountByType", goods);
    }

    public List<TgGoods> getGoodsByType(TgGoods goods, Page page) {
        goods.setFirstrownum(page.getFirstrownum());
        goods.setPagesize(page.getPagesize());
        List<TgGoods> list = this.queryForEntityList(TgGoods.class, "getGoodsByType", goods);
        return list;
    }

    @Override
    public Integer getMyGoodsCountByType(TgGoods goods) {
        return this.queryForInteger("getMyGoodsCountByType", goods);
    }

    @Override
    public List<TgGoods> getMyGoodsByType(TgGoods goods, Page page) {
        goods.setFirstrownum(page.getFirstrownum());
        goods.setPagesize(page.getPagesize());
        List<TgGoods> list = this.queryForEntityList(TgGoods.class, "getMyGoodsByType", goods);
        return list;
    }

    @Override
    public List<TgGoods> getGoodsNameByGood(TgGoods goods, Page page) {
        return null;
    }

    @Override
    public List<TgGoods> getGoodsByTypeGoodNameId(TgGoods tgGoods) {
        List<TgGoods> list = this.queryForEntityList(TgGoods.class, "getGoodsByTypeGoodNameId", tgGoods);
        return list;
    }
}
